﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SkyFab.Master" AutoEventWireup="true" CodeBehind="MakeCustomerPO.aspx.cs" Inherits="Web.MakeCustomerPO" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style1
        {
            width: 334px;
        }
    </style>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:Label ID="FlashMessageLabel" runat="server"></asp:Label>
    <asp:ScriptManager ID="ScriptManager1" runat="server"/>
        <h1>Create Customer Purchase Order/Contract Order</h1>

        <div class="span-9">
        <fieldset>
            <legend>Customer Information</legend>
            
            <p>
            <label>Customer:</label>
                <asp:DropDownList ID="CustomerDropDownList" runat="server" Width="150" 
                    AutoPostBack="True" 
                    onselectedindexchanged="CustomerDropDownList_SelectedIndexChanged"/>
            </p>
            
            <p><label>Ship-To: (Customer Address)</label></p>
            <p>
                <asp:TextBox ID="ShipToTextBox1" runat="server" CssClass="text span-7"></asp:TextBox>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                    ControlToValidate="ShipToTextBox1" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
            </p>

            <p> 
                <asp:TextBox ID="ShipToTextBox2" runat="server"  CssClass="text span-7"></asp:TextBox>
            </p>
            <p>
                <asp:TextBox ID="ShipToTextBox3" runat="server"  CssClass="text span-7"></asp:TextBox>
            </p>

            <p>
                <label>Zip Code:</label>
                <asp:TextBox ID="ZipCodeTextBox" runat="server" Width="160" CssClass="text"></asp:TextBox>
            </p>
        </fieldset>
        </div>

        <div class="span-9">
        <fieldset>
            <legend>Order Information</legend>

             <p>
                <asp:RadioButtonList ID="POTypeRadioButtonList" runat="server" RepeatDirection="Horizontal">
                <asp:ListItem Text="Purchase Order" Value="purchase" Selected="True"/>
                <asp:ListItem Text="Contract Order" Value="contract" />
                </asp:RadioButtonList>
            </p>

            <p>
            <label>PO Number:</label>
            <asp:TextBox ID="PONumberTextBox" runat="server" CssClass="text" Width="150"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ControlToValidate="PONumberTextBox" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
            </p>

            <p>
            <label>PO Date:</label>
            <asp:TextBox ID="PODateTextBox" runat="server" CssClass="text" Width="150"></asp:TextBox>
            <asp:CalendarExtender ID="PODateTextBox_CalendarExtender" runat="server" 
                Enabled="True" TargetControlID="PODateTextBox" Format="d MMM, yyyy">
            </asp:CalendarExtender>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                ControlToValidate="PODateTextBox" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
            </p>

            <p>
            <label>Quotation No:</label>
            <asp:TextBox ID="ReferenceTextBox" runat="server" CssClass="text" Width="150"></asp:TextBox>
            </p>

            <p>
            <label>Total Qty:</label>
            <asp:TextBox ID="TotalQtyTextBox" runat="server" CssClass="text" Width="150"></asp:TextBox>
            </p>
            <p>(This field(Total Qty) is ONLY for contract order! Leave it blank for purchase order.)</p>

            <p>
            <label>Remark:</label>
            <asp:TextBox ID="RemarkTextBox" runat="server" Height="50px" TextMode="MultiLine" CssClass="span-7"></asp:TextBox>
            </p>

        </fieldset>
        </div>


        <div class="span-18">
           <fieldset>
           <legend>Select Product</legend>
           <p>
           <label>Product No/ Revision:</label>
               <asp:DropDownList ID="ProductDropDownList" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ProductDropDownList_SelectedIndexChanged" Width="160">
               </asp:DropDownList>
                
            
            <label>Requested Date:</label>
            <asp:TextBox ID="RequestedDateTextBox" runat="server" CssClass="text" Width="150"></asp:TextBox>
                                <asp:CalendarExtender ID="RequestedDateTextBox_CalendarExtender0" 
                                    runat="server" TargetControlID="RequestedDateTextBox"
                                    Format="d MMM, yyyy">
                                </asp:CalendarExtender>
                                <asp:RequiredFieldValidator ID="RequestedDateTextBoxRequiredFieldValidator" runat="server" 
                                    ErrorMessage="*" ControlToValidate="RequestedDateTextBox" ForeColor="Red">
                                </asp:RequiredFieldValidator>

            </p>

            <p>
            <label>Product Name:</label>
            <asp:Label ID="ProductNameLabel" runat="server"></asp:Label>
            </p>

            <p>
            <label>Quantity:</label>
            <asp:TextBox ID="QuantityTextBox" runat="server" CssClass="text" Width="70"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="QuantityTextBoxRequiredFieldValidator" runat="server" 
                                    ErrorMessage="*" ControlToValidate="QuantityTextBox" ForeColor="Red">
                                </asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="QuantityTextBoxRegularExpressionValidator" runat="server" 
                                ControlToValidate="QuantityTextBox" ErrorMessage="*" ForeColor="Red" 
                                ValidationExpression="^[1-9]\d*$">
                                </asp:RegularExpressionValidator>

            <label>Net Price (USD):</label>
            <asp:TextBox ID="NetPriceTextBox" runat="server" CssClass="text" Width="70"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="NetPriceTextBoxRequiredFieldValidator" runat="server" 
                                    ErrorMessage="*" ControlToValidate="NetPriceTextBox" ForeColor="Red">
                                </asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="NetPriceTextBoxRegularExpressionValidator" runat="server" 
                                ControlToValidate="NetPriceTextBox" ErrorMessage="*" ForeColor="Red" 
                                ValidationExpression="^[0-9]+(.[0-9]{1,2})?$">
                                </asp:RegularExpressionValidator>

            <label>Lot:</label>
            <asp:TextBox ID="LotTextBox" runat="server" CssClass="text" Width="70"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="LotTextBoxRequiredFieldValidator" runat="server" 
                                    ErrorMessage="*" ControlToValidate="LotTextBox" ForeColor="Red">
                                </asp:RequiredFieldValidator>
                                <asp:RegularExpressionValidator ID="LotTextBoxRegularExpressionValidator" runat="server" 
                                ControlToValidate="LotTextBox" ErrorMessage="*" ForeColor="Red" 
                                ValidationExpression="^[1-9]\d*$">
                                </asp:RegularExpressionValidator>
            
            <asp:Button ID="InsertButton" runat="server" onclick="InsertButton_Click" 
                                    Text="Insert" CssClass="submitButton" />
            </p>
           </fieldset>
        
        </div>
           
    <div class="span-18">
    <fieldset>
    <legend>Product List</legend>
    <p>
    <asp:CheckBox ID="SameDateCheckBox" runat="server" AutoPostBack="True" 
                oncheckedchanged="SameDateCheckBox_CheckedChanged" />
    Choose same date for each item.
    </p>
    <asp:GridView ID="CustomerPOItemGridView" runat="server" 
                AutoGenerateColumns="False" CellPadding="4" 
                GridLines="None" CssClass="gridview" Width="100%" DataKeyNames="ProductId">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                <asp:TemplateField Visible="False" ItemStyle-Width="0">
                        <ItemTemplate>
                            <asp:HiddenField ID="ProductIdHiddenField" runat="server" 
                                Value='<%#Eval("ProductId") %>' Visible="False"/>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="ProductNo" HeaderText="Item No" />
                    <asp:BoundField DataField="ProductName" HeaderText="Name" />
                    <asp:BoundField DataField="Revision" HeaderText="Revision" />
                    <asp:TemplateField HeaderText="Requested Date">
                        <ItemTemplate>
                            <asp:TextBox ID="RequestedDateTextBox" runat="server" Text='<%#Eval("FormatDate") %>' Width="80px"></asp:TextBox>
                            <asp:CalendarExtender ID="RequestedDateTextBox_CalendarExtender" runat="server" 
                                Enabled="True" TargetControlID="RequestedDateTextBox" Format="d MMM, yyyy">
                            </asp:CalendarExtender>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                                ControlToValidate="RequestedDateTextBox" ErrorMessage="*" ForeColor="Red">
                            </asp:RequiredFieldValidator>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Quantity">
                        <ItemTemplate>
                            <asp:TextBox ID="RequestQtyTextBox" runat="server" Height="19px" Width="38px" Text='<%#Eval("RequestQty") %>' Enabled="false"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequestQtyTextBoxRequiredFieldValidator" runat="server" 
                                ControlToValidate="RequestQtyTextBox" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RequestQtyTextBoxRegularExpressionValidator" runat="server" 
                                ControlToValidate="RequestQtyTextBox" ErrorMessage="*" ForeColor="Red" 
                                ValidationExpression="^[1-9]\d*$"></asp:RegularExpressionValidator>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Price">
                        <ItemTemplate>
                            <asp:TextBox ID="PriceTextBox" runat="server" Height="19px" Width="38px" Text='<%#Eval("Price") %>' Enabled="false"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="PriceRequiredFieldValidator" runat="server" 
                                ControlToValidate="PriceTextBox" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="PriceTextBoxRegularExpressionValidator" runat="server" 
                                ControlToValidate="PriceTextBox" ErrorMessage="*" ForeColor="Red" 
                                ValidationExpression="^[0-9]+(.[0-9]{1,2})?$">
                            </asp:RegularExpressionValidator>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Lot">
                        <ItemTemplate>
                            <asp:TextBox ID="LotTextBox" runat="server" Height="19px" Width="38px" Text='<%#Eval("Lot") %>' ></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                                ControlToValidate="LotTextBox" ErrorMessage="*" ForeColor="Red"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
                                ControlToValidate="LotTextBox" ErrorMessage="*" ForeColor="Red" 
                                ValidationExpression="^[1-9]\d*$"></asp:RegularExpressionValidator>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Delete">
                        <ItemTemplate>
                            <asp:Button ID="DeleteButton" runat="server" onclick="DeleteButton_Click" 
                                Text="Del" ToolTip="Delete" CssClass="submitButton" />
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    
                </Columns>
                
                    <AlternatingRowStyle BackColor="White" />
                    <EditRowStyle BackColor="#2461BF" />
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <PagerStyle HorizontalAlign="Center" CssClass="pagerTable" />
                    <RowStyle BackColor="#EFF3FB" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <SortedAscendingCellStyle BackColor="#F5F7FB" />
                    <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                    <SortedDescendingCellStyle BackColor="#E9EBEF" />
                    <SortedDescendingHeaderStyle BackColor="#4870BE" />
            </asp:GridView>
    </fieldset>
    </div>

    <div class="span-9">
    <fieldset>
    <legend>Shipping Information</legend>

    <p>
    <label>Shipping Mode:</label>
    <asp:DropDownList ID="ShippingModeDropDownList" 
                runat="server" Width="150">
            <asp:ListItem>Air</asp:ListItem>
            </asp:DropDownList>
    </p>

    <p>
    <label>Carrier:</label>
    <asp:DropDownList ID="CarrierDropDownList" runat="server" Width="150">
                <asp:ListItem>UPS</asp:ListItem>
                <asp:ListItem>FEDEX</asp:ListItem>
            </asp:DropDownList>
    </p>

    <p>
    <label>Payment Terms:</label>
    <asp:DropDownList ID="PaymentTermsDropDownList" runat="server" Width="150">
                <asp:ListItem Value="WireTransfer">Wire Transfer</asp:ListItem>
                <asp:ListItem>Cash</asp:ListItem>
            </asp:DropDownList>
    </p>
    </fieldset>
    
    </div>
   
   <div class="span-9">
   <fieldset>
   <legend>PO Summary</legend>
   <p>
   <label>Total(USD):</label>
   <asp:Label ID="TotalLabel" runat="server" Text="Label"></asp:Label>
   </p>


   <p>
      <asp:Button ID="SubmitButton" runat="server" Text="Submit" 
                onclick="SubmitButton_Click" CssClass="submitButton" />
            <input type="reset" value="Reset" class="submitButton" />
   </p>
   </fieldset>
   </div>

   <div class="span-18">

   </div>
       
    
            

</asp:Content>
